package com.lei.action;

import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import com.lei.pojo.User;
import com.lei.service.UserService;


public class AppAction {
	
	private UserService userService;
	private User user;

	public String execute() {
		return "success";
	}
	
	@Action("login")
	public String login(){
		user=userService.findByUsernameAndPassword(user);
		if(user!=null){
		return "success";
		}else{
			return "error";
		}
	}
	
	
	
	@Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
